import requests
import re

data = {'ClickID':'1'}
url = "https://bj.58.com/dashanzi/chuzu/pn1/"

res = requests.get(url,params=data)

html = res.content.decode("utf-8")





pat = '<img.*?lazy_src="(.*?)".*?src=.*?>.*?<h2>.*?<a href=".*?".*?class="strongbox".*?tongji_label="listclick".*?target="_blank".*?>(.*?)</a>.*?<p class="room strongbox">(.*?)&nbsp.*?<div class="money">.*?<b class="strongbox">(.*?)</div>'
                
                                            

dlist = re.findall(pat,html,re.S)

x=1
for v in dlist:
    print(str(x)+"标题:"+v[1].strip()+"\n"+"户型:"+v[2].strip()+"\n"+"价格:"+v[3].strip()+"元/月"+"\n"+"图片:"+"http:"+v[0].strip()+"\n")
    x+=1




    




